// 
const EventEmitter = require('events');

class MyEmitter extends EventEmitter { };

const myEmitter = new MyEmitter();

myEmitter.on('testFun', function (a, b) {
  console.log(`${a} + ${b} = ${a + b}`);
})

myEmitter.on('testFun', function (a, b) { // 不会重载覆盖
  console.log(`${a} - ${b} = ${a - b}`);
})

myEmitter.emit('testFun', 3, 5)

console.log(myEmitter.getMaxListeners()); // 默认10个

myEmitter.setMaxListeners(20);

console.log(myEmitter.getMaxListeners());

console.log(myEmitter.listenerCount('testFun'))

// removeAllListeners